/*
 * Copyright (c) 2006-2021, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-02-24     86188       the first version
 */
#ifndef APPLICATIONS_HEADER_FILE_SPI_DRV_H_
#define APPLICATIONS_HEADER_FILE_SPI_DRV_H_
#include "drv_spi.h"
#include "head_rtthread.h"

typedef struct
{
    struct rt_spi_device* ICM42688;
    struct rt_spi_device* MS5611;
    struct rt_spi_device* ICM20602;
    rt_sem_t sem;
}SPI1dev_HandleTypedef;
typedef struct
{
    struct rt_spi_device* FM25V05;
    rt_sem_t sem;
}SPI2dev_HandleTypedef;

typedef struct
{
    SPI1dev_HandleTypedef SPI1dev;
    SPI2dev_HandleTypedef SPI2dev;
    rt_size_t (*RWBytes)(struct rt_spi_device *device, const void *send_buf, void *recv_buf, rt_size_t length);
    rt_err_t  (*WthenRs)(struct rt_spi_device *device, const void *send_buf,  rt_size_t send_length,  void *recv_buf,        rt_size_t recv_length);
    rt_err_t  (*WthenWs)(struct rt_spi_device *device, const void *send_buf1, rt_size_t send_length1, const void *send_buf2, rt_size_t send_length2);
}SPI_HandleTypedef;
extern SPI_HandleTypedef SPI_Handle;

#endif /* APPLICATIONS_HEADER_FILE_SPI_DRV_H_ */
